package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DocDocumentMapper;
import com.ruoyi.system.domain.DocDocument;
import com.ruoyi.system.service.IDocDocumentService;
import com.ruoyi.common.core.text.Convert;

/**
 * 文档Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-25
 */
@Service
public class DocDocumentServiceImpl implements IDocDocumentService 
{
    @Autowired
    private DocDocumentMapper docDocumentMapper;

    /**
     * 查询文档
     * 
     * @param documentId 文档主键
     * @return 文档
     */
    @Override
    public DocDocument selectDocDocumentByDocumentId(Long documentId)
    {
        return docDocumentMapper.selectDocDocumentByDocumentId(documentId);
    }

    /**
     * 查询文档列表
     * 
     * @param docDocument 文档
     * @return 文档
     */
    @Override
    public List<DocDocument> selectDocDocumentList(DocDocument docDocument)
    {
        return docDocumentMapper.selectDocDocumentList(docDocument);
    }

    /**
     * 新增文档
     * 
     * @param docDocument 文档
     * @return 结果
     */
    @Override
    public int insertDocDocument(DocDocument docDocument)
    {
        docDocument.setCreateTime(DateUtils.getNowDate());
        return docDocumentMapper.insertDocDocument(docDocument);
    }

    /**
     * 修改文档
     * 
     * @param docDocument 文档
     * @return 结果
     */
    @Override
    public int updateDocDocument(DocDocument docDocument)
    {
        docDocument.setUpdateTime(DateUtils.getNowDate());
        return docDocumentMapper.updateDocDocument(docDocument);
    }

    /**
     * 批量删除文档
     * 
     * @param documentIds 需要删除的文档主键
     * @return 结果
     */
    @Override
    public int deleteDocDocumentByDocumentIds(String documentIds)
    {
        return docDocumentMapper.deleteDocDocumentByDocumentIds(Convert.toStrArray(documentIds));
    }

    /**
     * 删除文档信息
     * 
     * @param documentId 文档主键
     * @return 结果
     */
    @Override
    public int deleteDocDocumentByDocumentId(Long documentId)
    {
        return docDocumentMapper.deleteDocDocumentByDocumentId(documentId);
    }
}
